package cloud.lysky.game.gamesampe.util;

import cloud.lysky.game.gamesampe.HelloFXGLApplication;
import cloud.lysky.game.gamesampe.component.HealthComponent;
import cloud.lysky.game.gamesampe.component.SkillComponent;
import cloud.lysky.game.gamesampe.component.StatsComponent;
import cloud.lysky.game.gamesampe.entity.Enemy;
import com.google.common.collect.Lists;
import javafx.scene.paint.Color;

import java.util.ArrayList;
import java.util.List;

public class EnemyUtil {
    private static final List<Enemy> enemies = new ArrayList<>();

    private static void initEnemies(){
        enemies.clear();
        enemies.add(Enemy.buildSimpleEnemy("史莱姆", 1000, 0, 180, 30));
        enemies.add(Enemy.buildSimpleEnemy("野狼", 900, 0, 220, 50));
        enemies.add(Enemy.buildSimpleEnemy("哥布林", 1400, 0, 160, 10));
        enemies.add(Enemy.buildSimpleEnemy("野猪", 1800, 0, 260, 80));
        enemies.forEach(enemy -> {
            enemy.addComponent(new HealthComponent(enemy.getHP()));
            enemy.addComponent(new StatsComponent(enemy.getName(), enemy.getATK(), enemy.getDefense(), 0, 0));
            enemy.addComponent(new SkillComponent(enemy.getSkills()));
        });
    }

    public static List<Enemy> loadEnemies() {
        if (enemies.isEmpty()) {
            initEnemies();
        }
        return enemies;
    }
}
